package com.tuantuan.common.base.param;

import com.tuantuan.common.base.common.CommonConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Map;

/**
 * 查询参数
 *
 * @author wangqinmin
 * @since 2018-11-08
 */
@ApiModel("查询参数")
public class QueryParam implements Serializable {

    private static final long serialVersionUID = 7305222607977143006L;

    @ApiModelProperty(value = "页码,默认为1")
    private Integer current;

    @ApiModelProperty(value = "页大小,默CommonConstant认为10")
    private Integer size;

    /**
     * 格式例如:{"t_name":"蔡文姬","phone":"","age":"18"}
     */
    @ApiModelProperty(value = "非必传-模糊查询输入值 格式例如:{'name':'蔡文姬','phone':'','age':'19'} 则查询出名字带有蔡文姬 和 年龄带有19的所有数据")
    private Map<String, String> searchMap;


    public Integer getCurrent() {
        return current;
    }

    public QueryParam setCurrent(Integer current) {
        this.current = "".equals(current) || current == null ? CommonConstant.DEFAULT_PAGE_INDEX : current;
        return this;
    }

    public Integer getSize() {
        return size;
    }

    public QueryParam setSize(Integer size) {
        this.size = "".equals(size) || size == null ? CommonConstant.DEFAULT_PAGE_SIZE : size;
        return this;
    }

    public Map<String, String> getSearchMap() {
        return searchMap;
    }

    public QueryParam setSearchMap(Map<String, String> searchMap) {
        this.searchMap = searchMap;
        return this;
    }
}
